package cn.zl.ymcc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RestController
@RequestMapping("createToken")
public class orderController {
    @Autowired
    private RedisTemplate redisTemplate;
    @GetMapping("/{courseId}")
    public String createToken(@PathVariable("courseId") String courseId){
        Long l = System.currentTimeMillis();
        redisTemplate.opsForValue().set("order:"+courseId,l.toString(),5, TimeUnit.MINUTES);

        return l.toString();
    }

}
